﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace OpenExpressApp
{
    /// <summary>
    /// 基础异常
    /// </summary>
    [Serializable()]
    public class GException : Exception
    {
        private object _businessObject;

        public GException(string message, object businessObject)
            : base(message)
        {
            _businessObject = businessObject;
        }

        protected GException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            _businessObject = info.GetValue("_businessObject", typeof(object));
        }

        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            base.GetObjectData(info, context);
            info.AddValue("_businessObject", _businessObject);
        }
    }
}
